package com.ty.controller;

import com.ty.pojo.FettersAndPaertner;
import com.ty.service.FettersAndPaertnerService;
import com.ty.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@RestController
@CrossOrigin
@EnableSwagger2
@RequestMapping("/fettersAndPaertner")
public class FettersAndPaertnerController {
    @Autowired
    private FettersAndPaertnerService fettersAndPaertnerService;

    //羁绊表新增伙伴
    @PostMapping("/addPartner/{fettersId}/{partnerId}")
    @Transactional
    public SysResult addPartner(FettersAndPaertner fettersAndPaertner){
        fettersAndPaertnerService.addPartner(fettersAndPaertner);
        return SysResult.success();
    }

    //羁绊表删除伙伴
    @DeleteMapping("/deletePartner/{fettersId}/{partnerId}")
    public SysResult deletePartner(FettersAndPaertner fettersAndPaertner){
        fettersAndPaertnerService.deletePartner(fettersAndPaertner);
        return SysResult.success();
    }
}
